package cn.elead.chaos.email.service.impl;

import cn.elead.chaos.email.domain.CustomMailMessage;
import cn.elead.chaos.email.service.ISubjectAttachService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DefaultSubjectAttachService implements ISubjectAttachService {

	@Override
	public void loadSubjectContext(CustomMailMessage message) {

		// 通过subjectId获取邮件主题和模板
		// CustomMailMessage subject = new CustomMailMessage();
		// subject.setSubject("主题：来自罗鹏邮件");
		// String content = "<html>\n" + "<body>\n" + "
		// <h3>您好${name},这是验证邮件,请点击下面的链接完成验证!</h3>\n" + "</body>\n" + "</html>";
		// subject.setText(content);
		// return subject;

		log.warn("请配置ISubjectAttachService接口的loadSubjectContext实现.");
		throw new RuntimeException("请配置 ISubjectAttachService接口的loadSubjectContext实现.");
	}

	@Override
	public void loadAttachment(CustomMailMessage message) {

		// Map<String, File> attachments = new HashMap<String, File>();

		// 添加附件
		// File qrCode = new File("wxgzh8cm.jpg");
		// 建议文件带上后缀，可支持在线预览
		// attachments.put("公众号二维码.jpg", qrCode);

		// message.setAttachments(attachments);

		// return message;

		// FileSystemResource qrCode = new FileSystemResource(new
		// File("wxgzh8cm.jpg"));
		// String fileName =
		// filePath.substring(filePath.lastIndexOf(qrCode.separator));
		// helper.addAttachment("公众号二维码.jpg", qrCode);

		log.warn("请配置ISubjectAttachService接口的loadAttachment实现.");
		throw new RuntimeException("请配置 ISubjectAttachService接口的loadAttachment实现.");
	}

	@Override
	public void loadResource(CustomMailMessage message) {
		// String rscId = "test006";
		// String content="<html><body>这是有图片的邮件：<img src=\'cid:" + rscId + "\'></body></html>";
		// String imgPath = "D:\\01.jpg";
		// FileSystemResource res = new FileSystemResource(new File(rscPath));
		// helper.addInline(rscId, res);

		log.warn("请配置ISubjectAttachService接口的loadResource实现.");
		throw new RuntimeException("请配置 ISubjectAttachService接口的loadResource实现.");
	}

}
